<template>
    <div style="margin-top: 3%">
        <el-table :data="loaderTableData" style="width:79%;margin-left: 10%">
            <el-table-column
                    prop="datasetname"
                    label="数据集名称"
                    width="400">
            </el-table-column>
            <el-table-column
                    prop="successnumb"
                    label="已录入条数"
                    width="300"
                    align="center">
            </el-table-column>
            <el-table-column
                    prop="status"
                    label="状态"
                    width="100">
            </el-table-column>
            <el-table-column width="fit-content" align="center " label="操作">
                <template slot-scope="scope">
                    <el-button
                            prop=""
                            :disabled="scope.row.preDisabled"
                            title="预览"
                            icon="fa fa-table"
                            @click="previewDataSet(scope.$index,scope.row)"
                            type="text">
                        <!--<i class="el-icon-delete-solid"></i>-->
                    </el-button>
                    <el-button
                            :disabled="scope.row.logDisabled"
                            title="日志"
                            icon="el-icon-s-order"
                            @click="showDataSetLog(scope.$index,scope.row)"
                            type="text">
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
        <logDialog></logDialog>
    </div>
</template>

<script>
    import dataPreviewDialog from "./dataPreviewDialog.vue"
    import logDialog from '../space/logDialog'

    export default {
        name: "personalData",
        components: {
            dataPreviewDialog,
            logDialog,
        },
        data() {
            return {
                loaderTableData: [],
            };
        },
        methods: {
            getDataSet() {
                let that = this;
                let url = "http://localhost:9000/dbfg/personalDataset/get";
                this.$axios.get(url)
                    .then(function (res) {
                        if (res.code == 200) {
                            that.loaderTableData = res.body;
                            that.checkData(res.body);
                        } else {
                            that.$message({
                                message: '数据获取失败',
                                type: 'warning'
                            });
                        }
                    });
                console.log("fn()函数被执行了");
            },
            previewDataSet(index, row) {


            }
            ,
            showDataSetLog(index, row) {
                let that = this;
                let url = "http://localhost:9000/dbfg/personalDataset/getlogByName?name=" + row.datasetname;
                this.$axios.get(url)
                    .then(function (res) {
                        if (res.code === 200) {
                            if (res.body == null) {
                                res.body = '没有错误'
                            }
                            that.$alert(res.body, '错误日志', {
                                confirmButtonText: '确定'
                            });
                        } else {
                            that.$message({
                                message: '数据获取失败',
                                type: 'warning'
                            });
                        }
                    });
            }
        }
        ,
        created() {
            this.getDataSet();
        }
    };
</script>

<style>

</style>